package TreeDayShuZu;

public class Dome04 {
    public static void main(String[] args) {
        //计算一维数组的总和
        int[]arr1={7,8,9};
        int count1=0;
        for (int i = 0; i < arr1.length ; i++) {
            count1+=arr1[i];
        }
        System.out.println("一维数组的和为"+count1);
        //计算二维数组总和
        int[][]arr={{6,8,9},{12,7},{13,14,0,3}};
        int count=0;//声明一个第三方变量
        for (int i = 0; i < arr.length ; i++) {
            for (int j = 0; j <arr[i].length; j++) {
                count+=arr[i][j];
            }
        }
        System.out.println("二维数组的总和为"+count);
    }
}
